/*********************************************************
 * copyright xinbohit.com 版权所有 
 * 开发人员：IvanYu
 * 创建时间：2014/8/17 13:27:23
 * 描述说明：
 * 
 * 更改历史：
 * 
 * *******************************************************/

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using LEARNREN.COM.DAL;

namespace LEARNREN.COM.BLL
{
    /// <summary>
    /// 分组逻辑
    /// </summary>
    public class GroupLogicFactory : IDisposable
    {
        DB4ODALClient mainClient = null;
        public GroupLogicFactory()
        {
            string mainConn = System.Configuration.ConfigurationManager.ConnectionStrings["mainBase"].ConnectionString;
            mainClient = DB4ODALServerHelper.GetIDALClient(mainConn);
        }


        private ArticleLogic _ArticleLogic;

        /// <summary>
        /// 组内唯一实例的文章逻辑
        /// </summary>
        public ArticleLogic ArticleLogic
        {
            get
            {
                if (_ArticleLogic == null)
                {
                    _ArticleLogic = new ArticleLogic(mainClient);
                }
                return _ArticleLogic;
            }
        }

        private BannerLogic _BannerLogic;
        /// <summary>
        /// 组内唯一实例的banner逻辑
        /// </summary>
        public BannerLogic BannerLogic
        {
            get
            {
                if (_BannerLogic == null)
                {
                    _BannerLogic = new BannerLogic(mainClient);
                }
                return _BannerLogic;
            }
        }

        private BannerGroupLogic _BannerGroupLogic;
        /// <summary>
        /// 组内唯一实例的bannergroup逻辑
        /// </summary>
        public BannerGroupLogic BannerGroupLogic
        {
            get
            {
                if (_BannerGroupLogic == null)
                {
                    _BannerGroupLogic = new BannerGroupLogic(mainClient);
                }
                return _BannerGroupLogic;
            }
        }

        private FriendLinkLogic _FriendLinkLogic;
        /// <summary>
        /// 组内唯一实例的FriendLinkLogic逻辑
        /// </summary>
        public FriendLinkLogic FriendLinkLogic
        {
            get
            {
                if (_FriendLinkLogic == null)
                {
                    _FriendLinkLogic = new FriendLinkLogic(mainClient);
                }
                return _FriendLinkLogic;
            }
        }

        private CatalogueLogic _CatalogueLogic;
        /// <summary>
        /// 组内唯一实例的分类逻辑
        /// </summary>
        public CatalogueLogic CatalogueLogic
        {
            get
            {
                if (_CatalogueLogic == null)
                {
                    _CatalogueLogic = new CatalogueLogic(mainClient);
                }
                return _CatalogueLogic;
            }
        }

        private CustomSectionLogic _CustomSectionLogic;
        /// <summary>
        /// 组内唯一实例的自定义节逻辑
        /// </summary>
        public CustomSectionLogic CustomSectionLogic
        {
            get
            {
                if (_CustomSectionLogic == null)
                {
                    _CustomSectionLogic = new CustomSectionLogic(mainClient);
                }
                return _CustomSectionLogic;
            }
        }

        private JobLogic _JobLogic;
        /// <summary>
        /// 组内唯一实例的自定义节逻辑
        /// </summary>
        public JobLogic JobLogic
        {
            get
            {
                if (_JobLogic == null)
                {
                    _JobLogic = new JobLogic(mainClient);
                }
                return _JobLogic;
            }
        }

        private MessageLogic _MessageLogic;
        /// <summary>
        /// 组内唯一实例的留言逻辑
        /// </summary>
        public MessageLogic MessageLogic
        {
            get
            {
                if (_MessageLogic == null)
                {
                    _MessageLogic = new MessageLogic(mainClient);
                }
                return _MessageLogic;
            }
        }

        private ProductLogic _ProductLogic;
        /// <summary>
        /// 组内唯一实例的产品逻辑
        /// </summary>
        public ProductLogic ProductLogic
        {
            get
            {
                if (_ProductLogic == null)
                {
                    _ProductLogic = new ProductLogic(mainClient);
                }
                return _ProductLogic;
            }
        }

        private ProjectLogic _ProjectLogic;
        /// <summary>
        /// 组内唯一实例的案例逻辑
        /// </summary>
        public ProjectLogic ProjectLogic
        {
            get
            {
                if (_ProjectLogic == null)
                {
                    _ProjectLogic = new ProjectLogic(mainClient);
                }
                return _ProjectLogic;
            }
        }

        private SiteLogic _SiteLogic;
        /// <summary>
        /// 站点配置
        /// </summary>
        public SiteLogic SiteLogic
        {
            get
            {
                if (_SiteLogic == null)
                {
                    _SiteLogic = new SiteLogic(mainClient);
                }
                return _SiteLogic;
            }
        }
        /// <summary>
        /// 释放
        /// </summary>
        public void Dispose()
        {
            this.mainClient.Dispose();
        }
    }
}
